﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Data.SqlClient;
using Binding = System.Windows.Data.Binding;
using black_screen_client.Models;
using System.Collections.ObjectModel;

namespace black_screen_client
{
    /// <summary>
    /// RencentEvents.xaml 的交互逻辑
    /// </summary>
    public partial class RencentEvents : Window
    {
        public RencentEvents()
        {
            InitializeComponent();

        }

        public ObservableCollection<EventDataModel> LogData { get; set; }
        public void LoadReport(string jsonData)
        {
            this.LogData = new ObservableCollection<EventDataModel>();
            var obj = Newtonsoft.Json.JsonConvert.DeserializeObject<LogResponseData>(jsonData);

            this.LogData.Clear();
            foreach (var item in obj.LogData)
            {
                this.LogData.Add(item);
            }

           
            //ReportDataGrid.Columns.Add(new DataGridTextColumn() { Header = "触发时间", Binding = new Binding("LocalTime") });
            //ReportDataGrid.Columns.Add(new DataGridTextColumn() { Header = "点位", Binding = new Binding("Source") });
            ////ReportDataGrid.Columns.Add(new DataGridTextColumn() { Header = "类型编号", Binding = new Binding("category") });
            //ReportDataGrid.Columns.Add(new DataGridTextColumn() { Header = "类型", Binding = new Binding("Category") });
            //ReportDataGrid.Columns.Add(new DataGridTextColumn() { Header = "区域", Binding = new Binding("AreaCode") });
            //ReportDataGrid.Columns.Add(new DataGridTextColumn() { Header = "优先级", Binding = new Binding("Priority") });
            //ReportDataGrid.Columns.Add(new DataGridTextColumn() { Header = "描述", Binding = new Binding("Description") });


            ReportDataGrid.ItemsSource = this.LogData;
        }
    }
}
